]> dgit.raspbian.org Git - gnome-shell.git/commitdiff
gdm/authPrompt: Factorize the entry update code
authorMarco Trevisan (Treviño) <mail@3v1n0.net>
Tue, 26 Aug 2025 14:40:07 +0000 (16:40 +0200)
committerMarge Bot <marge-bot@gnome.org>
Sat, 30 Aug 2025 01:36:14 +0000 (01:36 +0000)
Cleanup the code a bit to make future updates smaller

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/3850>

js/gdm/authPrompt.js

index d7e94000d8e8d963fe103bd3305c5f9b3c864427..b6fdb65e901a85bf9dc29bb434cd82e67b7fe84b 100644 (file)
@@ -293,15 +293,22 @@ export const AuthPrompt = GObject.registerClass({
     }
 
     _updateEntry(secret) {
+        let newEntry, inactiveEntry;
+
         if (secret && this._entry !== this._passwordEntry) {
-            this._mainBox.replace_child(this._entry, this._passwordEntry);
-            this._entry = this._passwordEntry;
-            this._inactiveEntry = this._textEntry;
+            newEntry = this._passwordEntry;
+            inactiveEntry = this._textEntry;
         } else if (!secret && this._entry !== this._textEntry) {
-            this._mainBox.replace_child(this._entry, this._textEntry);
-            this._entry = this._textEntry;
-            this._inactiveEntry = this._passwordEntry;
+            newEntry = this._textEntry;
+            inactiveEntry = this._passwordEntry;
+        }
+
+        if (newEntry) {
+            this._mainBox.replace_child(this._entry, newEntry);
+            this._entry = newEntry;
+            this._inactiveEntry = inactiveEntry;
         }
+
         this._capsLockWarningLabel.visible = secret;
     }